package com.dsx.haha.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsx.haha.model.entity.Article;
import com.dsx.haha.model.entity.Role;
import com.dsx.haha.model.entity.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author dsx
 * @date 2021/3/11 12:56
 * @since JDK1.8
 */
public interface UserMapper extends BaseMapper<User> {
    //添加用户
    int addUser(User user);
    //添加用户-角色信息
    int addUserRole(Map map);

    User getUser(String username);
    User getUserById(String id);
    List<String> getUserRoles(String id);
    
    //获取当前管理员下的所有租户
    List<Map> getAdminTenants(@Param("id") String id);
    //获取当前员工的所有租户
    List<Map> getUserTenants(@Param("id") String id);

    String getUserId(String username);

    List<Article> getArtByTenantId(String id);
}
